<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // 假如投资的年利率为 5%，试求从 1000 块增长到 5000 块，需要花费多少年？
        var money = 1000;
        var years = 0 ;

        while(money < 5000){
            money = money * 1.05
            years++;
        }
        console.log(money,years);
    </script>
</body>
</html>